<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<s:head />
<link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Administraci&oacute;n de edificios</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/tabla.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme0.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/jquery-ui-1.8.6.custom.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/javascript/jquery-1.4.2.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/javascript/jquery-ui-1.8.6.custom.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/javascript/jquery.dataTables.min.js"></script>
<script>
   var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
   document.writeln('<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/' + StyleFile + '">');
</script>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/ie-sucks.css" />
<![endif]-->
</head>

<body>
	<div id="container">
    	<div id="header">
        	<h2>Administraci&oacute;n de edificios</h2>
        	<div id="topmenu">
				<tiles:useAttribute id="selected" name="selected" />
				<ul>
					<li <c:if test="${selected == 'dashboard'}">class="current"</c:if>><a href="${pageContext.request.contextPath}/home.action">Dashboard</a></li>
					
					<sec:authorize access="hasAnyRole('ROLE_ADMIN', 'RESP_EDIFICIOS')">
					<li <c:if test="${selected == 'edificios'}">class="current"</c:if>><a href="${pageContext.request.contextPath}/edificios/edificios-list.action">Edificios</a></li>
					</sec:authorize>
					
					<sec:authorize access="hasAnyRole('ROLE_ADMIN', 'RESP_GASTOS')">
					<li <c:if test="${selected == 'gastos'}">class="current"</c:if>><a href="${pageContext.request.contextPath}/gastos/list.action">Gastos</a></li>
					</sec:authorize>
					
					<sec:authorize access="hasAnyRole('ROLE_ADMIN', 'RESP_COBROS')">
					<li <c:if test="${selected == 'expensas'}">class="current"</c:if>><a href="${pageContext.request.contextPath}/expensas/list.action">Expensas</a></li>
					</sec:authorize>
					
					<sec:authorize access="hasRole('ROLE_ADMIN')">
					<li <c:if test="${selected == 'usuarios'}">class="current"</c:if>><a href="${pageContext.request.contextPath}/users/list-users.action">Usuarios</a></li>
					</sec:authorize>
					
					<sec:authorize access="hasAnyRole('ROLE_ADMIN', 'RESP_COBROS')">
					<li <c:if test="${selected == 'planes'}">class="current"</c:if>><a href="${pageContext.request.contextPath}/planes/list-planes.action">Planes de pago</a></li>
					</sec:authorize>
					
				</ul>
			</div>
      </div>
        <div id="top-panel">
        	<div id="panel">
            	<tiles:insertAttribute name="submenu"/>
            </div>
      </div>
        <div id="wrapper">
            <div id="content">
                <tiles:insertAttribute name="body"/>
            </div>
            <div id="sidebar">
  				<ul>
                	<li><h3><a href="#" class="options">Opciones</a></h3>
                		<ul>
                        	<li><a href="${pageContext.request.contextPath}/j_spring_security_logout" class="logout">Salir</a></li>
                        </ul>
                	</li>
                	
                	<!-- opciones del administrador -->
                	<sec:authorize access="hasRole('ROLE_ADMIN')">
                	<li><h3><a href="#" class="admin">Administrador</a></h3>
                        <ul>
                    		<li><a href="${pageContext.request.contextPath}/users/list-users.action" class="users">Lista de usuarios</a></li>
							<li><a href="${pageContext.request.contextPath}/users/add-user.action" class="useradd">Nuevo usuario</a></li>
                        </ul>
                    </li>
                    </sec:authorize>
                    
                    <sec:authorize access="hasAnyRole('ROLE_ADMIN', 'RESP_GASTOS')">
                    <li><h3><a href="${pageContext.request.contextPath}/gastos/list.action" class="folder_table">Gastos</a></h3>
          				<ul>
                            <li><a href="${pageContext.request.contextPath}/gastos/gasto.action" class="gastoadd">Registrar gasto</a></li>
							<li><a href="${pageContext.request.contextPath}/gastos/buscar.action" class="search">Buscar gasto</a></li>
							<sec:authorize access="hasRole('ROLE_ADMIN')">
								<li><a href="/buildadmin/gastos/list-tipos.action" class="category">Tipos</a></li>
							 </sec:authorize>
                        </ul>
                    </li>
                    </sec:authorize>
					<sec:authorize access="hasAnyRole('ROLE_ADMIN', 'RESP_COBROS')">
                    <li><h3><a href="${pageContext.request.contextPath}/expensas/list.action" class="folder_table">Expensas</a></h3>
          				<ul>
                            <sec:authorize access="hasRole('ROLE_ADMIN')">
							<li><a href="${pageContext.request.contextPath}/expensas/liquidar.action" class="pagenew">Liquidar expensas</a></li>
							</sec:authorize>
							<li><a href="${pageContext.request.contextPath}/expensas/buscar.action" class="search">Buscar Propiedad</a></li>
                        </ul>
                    </li>
                    </sec:authorize>
                    <sec:authorize access="hasAnyRole('ROLE_ADMIN', 'RESP_EDIFICIOS')">
                    <li><h3><a href="${pageContext.request.contextPath}/edificios/edificios-list.action" class="build">Edificios</a></h3>
          				<ul>
                            <li><a href="${pageContext.request.contextPath}/edificios/edificios-list.action" class="builds">Lista de edificios</a></li>
                            <li><a href="${pageContext.request.contextPath}/edificios/nuevo-edificio.action" class="buildadd">Alta de edificio</a></li>
                        </ul>
                    </li>
                    </sec:authorize>
                    
				</ul>       
          </div>
      </div>
        <div id="footer">
        <div id="credits">
   		<a href="http://ar.groups.yahoo.com/group/fiubataller2/">Taller de progracion II</a> - Aizpun | Calvo | Ulrich | Viera
        </div>
        <div id="styleswitcher">
            <ul>
                <li><a href="javascript: document.cookie='theme=0'; window.location.reload();" title="Default" id="defswitch">d</a></li>
                <li><a href="javascript: document.cookie='theme=1'; window.location.reload();" title="Blue" id="blueswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=2'; window.location.reload();" title="Green" id="greenswitch">g</a></li>
                <li><a href="javascript: document.cookie='theme=3'; window.location.reload();" title="Brown" id="brownswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=4'; window.location.reload();" title="Mix" id="mixswitch">m</a></li>
            </ul>
        </div>
        <br />
        </div>
</div>
</body>
</html>